package com.seocoo.worker.user.account;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;

import com.seocoo.worker.R;
import com.seocoo.worker.base.UtilStatus;
import com.seocoo.worker.base.http.BasePageRsp;
import com.seocoo.worker.base.refresh.SwipeRefreshMoreLayout;
import com.seocoo.worker.base.widget.AppToolBer;
import com.seocoo.worker.user.account.adapter.DepositListAdapter;
import com.seocoo.worker.user.account.adapter.MoneyListAdapter;
import com.seocoo.worker.user.account.entity.EDepositDesc;
import com.seocoo.worker.user.account.entity.EMoney;
import com.seocoo.worker.user.account.model.AccountModel;
import com.seocoo.worker.user.model.UserModel;
import com.sfh.lib.mvvm.LiveDataMatch;
import com.sfh.lib.ui.MVVMActivity;

/***
 * 资金奖励明细
 */
public class MoneyAllListActivity extends MVVMActivity {


    public static void start(Context context) {
        Intent intent = new Intent(context, MoneyAllListActivity.class);
        context.startActivity(intent);
    }
    private AppToolBer appToolBer;
    private SwipeRefreshMoreLayout swipeRefreshMoreLayout;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_moneyall_list_activity);
        UtilStatus.initStatus(this, Color.WHITE);
        initView();
    }

    private void initView() {
        swipeRefreshMoreLayout = findViewById(R.id.swipe_refresh_more_layout);
        swipeRefreshMoreLayout.setAdapter(new MoneyListAdapter(), true);
        swipeRefreshMoreLayout.setOnLoadingListener(nowPage -> {
            getViewModel(AccountModel.class).queryMoneyList(nowPage);
        });
        swipeRefreshMoreLayout.onAutoRefresh();
    }

    @LiveDataMatch
    public void onPageSuccess(BasePageRsp<EMoney> pageRsp) {
        swipeRefreshMoreLayout.onRefreshCompale(pageRsp);
    }
}
